<!--包含头部文件-->
{include file="public/header" /}
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 分类管理 <span class="c-gray en">&gt;</span> 分类列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"> <a class="btn btn-primary radius" onclick="o2o_s_edit('添加生活服务分类','{:url('category/add')}','','300')" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 添加分类</a></span> <span class="r"></span> </div>
	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
			<tr class="text-c">
				<th width="40"><input name="" type="checkbox" value=""></th>
				<th width="80">ID</th>
				<th width="100">分类</th>
				<th width="30">排序序号</th>
				<th width="150">新增时间</th>
				<th width="60">发布状态</th>
				<th width="100">操作</th>
			</tr>
			</thead>
			<tbody>
			{volist name="categorys" id="vo"}
			<tr class="text-c">
				<td><input name="" type="checkbox" value=""></td>
				<td>{$vo.id}</td>
				<td>{$vo.name}</td>
				<td class="text-c listorder"><input size="3" attr-id="{$vo.id}"  name="listorder" value="{$vo.listorder}"/></td>
				<td>{$vo.create_time}</td>
				<td class="td-status"><a href="{:url('category/status',['id'=>$vo.id, 'status'=>$vo.status==1?0:1])}" title="点击修改状态">{$vo.status|status}</a></td>
				<td class="td-manage"><a href="{:url('category/index',['parent_id'=>$vo.id])}">获取子栏目</a><a style="text-decoration:none" class="ml-5" onClick="o2o_s_edit('编辑','{:url('category/edit', ['id'=>$vo.id])}','',300)" href="javascript:;" title="编辑"><i class="Hui-iconfont">&#xe6df;</i></a> <a style="text-decoration:none" class="ml-5" onClick="o2o_del('{:url('category/status', ['id'=>$vo.id, 'status'=>-1])}')" href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a></td>
			</tr>
			{/volist}
			</tbody>
		</table>
	</div>
</div>
<!--包含头部文件-->
{include file="public/footer"/}
<script>
    var SCOPE = {
        'listorder_url': "{:url('category/listorder')}",
    };
    $('.listorder input').blur(function() {
        // 编写我们的抛送的逻辑
        //获取主键id
        var id = $(this).attr('attr-id');
        // 获取排序的值
        var listorder = $(this).val();

        var postData = {

            'id' : id,
            'listorder':listorder,
        };
        var url = SCOPE.listorder_url;
        // 抛送http
        $.post(url, postData, function(result){
            // 逻辑
            if(result.code == 1) {
                location.href=result.data;
            }else {
                alert(result.msg);
            }
        },"json");


    });
    /*页面 全屏-添加*/
    function o2o_edit(title,url){
        var index = layer.open({
            type: 2,
            title: title,
            content: url
        });
        layer.full(index);
    }

    /*添加或者编辑缩小的屏幕*/
    function o2o_s_edit(title,url,w,h){
        layer_show(title,url,w,h);
    }
    /*-删除*/
    function o2o_del(url){

        layer.confirm('确认要删除吗？',function(index){
            window.location.href=url;
        });
    }
</script>
</body>
</html>